clear all
close all

load('etdrs_pre&post.mat')
load('etdrs_far.mat')
load('subject_specification.mat')
scale_factors = [0.0085 0.0738 0.0479 0.0283];

for ss = 1:8
    for distance = 1:4
        if distance < 4

            va_pre_t(ss,distance) = visual_acuity.pre.training(ss,distance);
            va_post_t(ss,distance) = visual_acuity.post.training(ss,distance);

            cd_pre_t(ss,distance) = comfortable_distance.pre.training(ss,distance);
            cd_post_t(ss,distance) = comfortable_distance.post.training(ss,distance);
            
            
            va_pre_ct(ss,distance) = visual_acuity.pre.controltraining(ss,distance);
            va_post_ct(ss,distance) = visual_acuity.post.controltraining(ss,distance);

            cd_pre_ct(ss,distance) = comfortable_distance.pre.controltraining(ss,distance);
            cd_post_ct(ss,distance) = comfortable_distance.post.controltraining(ss,distance);
            
            
            va_pre_c(ss,distance) = visual_acuity.pre.control(ss,distance);
            va_post_c(ss,distance) = visual_acuity.post.control(ss,distance);
            
            cd_pre_c(ss,distance) = comfortable_distance.pre.control(ss,distance);
            cd_post_c(ss,distance) = comfortable_distance.post.control(ss,distance);
        
        else

            va_pre_t(ss,distance) = mean(visual_acuity.pre.training(ss,:));
            va_post_t(ss,distance) = mean(visual_acuity.post.training(ss,:));

            cd_pre_t(ss,distance) = mean(comfortable_distance.pre.training(ss,:));
            cd_post_t(ss,distance) = mean(comfortable_distance.post.training(ss,:));
            
            
            va_pre_ct(ss,distance) = mean(visual_acuity.pre.controltraining(ss,:));
            va_post_ct(ss,distance) = mean(visual_acuity.post.controltraining(ss,:));

            cd_pre_ct(ss,distance) = mean(comfortable_distance.pre.controltraining(ss,:));
            cd_post_ct(ss,distance) = mean(comfortable_distance.post.controltraining(ss,:));
            
            
            va_pre_c(ss,distance) = mean(visual_acuity.pre.control(ss,:));
            va_post_c(ss,distance) = mean(visual_acuity.post.control(ss,:));
            
            cd_pre_c(ss,distance) = mean(comfortable_distance.pre.control(ss,:));
            cd_post_c(ss,distance) = mean(comfortable_distance.post.control(ss,:));
        
        end
    end
end

